# Bitmap
#
# Building by using BMake
#
# $ Bitmap: Makefile    Rev. 1.0.7    2013-03-12T22:33+08:00 $

.include <../../Makefile.mk>

CFLAGS= -O2 -Wall

## DO NOT COMMENT OUT THE FOLLOW BELOW LINE ##
CFLAGS+= ${CONFIGURE_ARGS}
## DO NOT COMMENT OUT THE FOLLOW ABOVE LINE ##


STATIC_OBJS= libbitmap.a
SHARED_OBJS= libbitmap.so

EXEC_OBJS= bin_bitmap_v bin_bitmap_l

BUILD_OBJS= ${STATIC_OBJS}

.ifndef WITHOUT_SHARED
BUILD_OBJS+= ${SHARED_OBJS}
.endif


# Build Library
build: ${BUILD_OBJS} ${EXEC_OBJS}


bitmap.o: bitmap.c
	${STDCC} -fpic -c bitmap.c ${CFLAGS} -I./ -I../base

method.o: method.c
	${STDCC} -fpic -c method.c ${CFLAGS} -I./ -I../base

libbitmap.a: bitmap.o method.o
	${AR} libbitmap.a bitmap.o method.o
	${RANLIB} libbitmap.a

.ifndef WITHOUT_SHARED
libbitmap.so: bitmap.o method.o
	${LD} ${LDFLAGS} -soname=libbitmap.so -o libbitmap.so.0 -lc \
	bitmap.o method.o
	${LN} ./libbitmap.so.0 ./libbitmap.so
.endif


# Validation Test
bin_bitmap_v: validate_bitmap_v.c libbitmap.a
	${STDCC} -o bin_bitmap_v validate_bitmap_v.c ${CFLAGS} -I./ -I../base \
	libbitmap.a

bin_bitmap_l: validate_bitmap_l.c libbitmap.a
	${STDCC} -o bin_bitmap_l validate_bitmap_l.c ${CFLAGS} -I./ -I../base \
	libbitmap.a -lrt

# Clean All Object Files
clean:
	${RM} *.o
	${RM} *.a
	${RM} *.so
	${RM} *.so.0
	${RM} ${EXEC_OBJS}

